package com.xcity.pomelo.response;

import java.util.List;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.NameFilter;
import com.alibaba.fastjson.serializer.PropertyPreFilter;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.xcity.game.skill.PlayerSkill;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class SkillListResponse extends Response {
	
	private List<PlayerSkill> list;
	
	public SkillListResponse(int serial, List<PlayerSkill> list) {
		super(serial);
		this.list = list;
	}

	public List<PlayerSkill> getList() {
		return list;
	}

	public void setList(List<PlayerSkill> list) {
		this.list = list;
	}

	@JSONField(serialize = false)
	@Override
	public SerializeFilter[] getJsonSerializeFilters() {
		return FILTERS;
	}
	
	static class JSONFilter implements PropertyPreFilter, NameFilter {

		@Override
		public String process(Object object, String name, Object value) {
			return "exp0".equals(name) ? "exp" : name;
		}

		@Override
		public boolean apply(JSONSerializer serializer, Object object, String name) {
			return !"exp".equals(name);
		}
		
	}
	
	static SerializeFilter[] FILTERS = new SerializeFilter[] { new JSONFilter() };

}
